// 
import httpUtils from "@/core/utils/http.utils";
const urls = {
    'page': `/api/sjhj/exp/page`,
    'add': `/api/sjhj/exp/add`,//添加实验
    'dataPage': `/api/sjhj/datares/page`,//数据资源
    'hardPage': `/api/sjhj/hardwareres/page`,//硬件资源
    'modelPage': `/api/sjhj/modelres/page`,//模型资源,
    'experType': '/api/upms/sysDictItem/getDItemByDType/data_exper_type', // 实验类型,
    'resultApl': '/api/upms/sysDictItem/getDItemByDType/result_apl', // 结果提交方式,
    'selectResource': `/api/sjhj/exp/selectResource`, //,
    'resultAdd': `/api/sjhj/result/add`,//,成果添加
    'resultUpdate': `/api/sjhj/result/update`,//,成果更新
    'getResult': `/api/sjhj/result/`,//,获取成果列表
    'deleteExper': `/api/sjhj/exp/`,//,删除实验
    'updateResult': `/api/sjhj/exp/addR`,//,更新资源
    'resultDownload':'/api/sjhj/result/exportResultExcelByExpId/', // 成果下载
    'resultUpload': '/api/sjhj/result/upload', //实验成果上传
    'resourceDownload':'/api/sjhj/resapl/exportResAplExcelByExpId/', // 资源下载
    'updateExp':'/api/sjhj/exp/updateExp', // 开启结束实验
    'approve':'/api/sjhj/exp/urge/', // 催批
};
// service methods
const experApi = {
    getPage(params) {
        return httpUtils.get(urls.page, params);
    },
    add(params) {
        return httpUtils.postRequest(urls.add, params);
    },
    updateResult(params) {
        return httpUtils.postRequest(urls.updateResult, params);
    },
    updateExp(params) {
        return httpUtils.postRequest(urls.updateExp, params);
    },
    deleteExper(params) {
        return httpUtils.delete(urls.deleteExper + params);
    },
    resultAdd(params) {
        return httpUtils.postRequest(urls.resultAdd, params);
    },
    resultUpdate(params) {
        return httpUtils.postRequest(urls.resultUpdate, params);
    },
    getResult(params) {
        return httpUtils.get(urls.getResult + params);
    },
    dataPage(params) {
        return httpUtils.get(urls.dataPage, params);
    },
    hardPage(params) {
        return httpUtils.get(urls.hardPage, params);
    },
    modelPage(params) {
        return httpUtils.get(urls.modelPage, params);
    },
    experType(params) {
        return httpUtils.get(urls.experType, params);
    },
    resultApl(params) {
        return httpUtils.get(urls.resultApl, params);
    },
    selectResource(params) {
        return httpUtils.get(urls.selectResource, params)
    },
    resultDownload(expId, fileName) {
        return httpUtils.downloadUrlMode(urls.resultDownload + expId, 'post', fileName, null, 'xlsx')
    },
    resultUpload(params) {
        return httpUtils.uploadFile(urls.resultUpload, params);
    },
    resourceDownload(expId, fileName) {
        return httpUtils.downloadUrlMode(urls.resourceDownload + expId, 'post', fileName, null, 'xlsx')
    },
    approve(expId) {
        return httpUtils.postRequest(urls.approve + expId);
    }
}


export default experApi;
